package com.ict.web.controller.yzq;

import java.util.List;

import com.ict.web.domain.ProfessionalQualification;
import com.ict.web.dto.InsertProfessionalQualificationDto;
import com.ict.web.dto.UpdateProfessionalQualificationDto;
import com.ict.web.service.IProfessionalQualificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ict.common.annotation.Log;
import com.ict.common.core.controller.BaseController;
import com.ict.common.core.domain.AjaxResult;
import com.ict.common.enums.BusinessType;
import com.ict.common.core.page.TableDataInfo;

/**
 * 职业资格Controller
 * 
 * @author liujie
 * @date 2022-02-23
 */
@Api(tags = "职业资格")
@RestController
@RequestMapping("/system/qualification")
public class ProfessionalQualificationController extends BaseController
{
    @Autowired
    private IProfessionalQualificationService professionalQualificationService;

    /**
     * 新增职业资格
     */
    @ApiOperation("新增职业资格")
    @Log(title = "职业资格", businessType = BusinessType.INSERT)
    @PostMapping("/addSave")
    public AjaxResult add(Long expertId,@RequestBody List<InsertProfessionalQualificationDto> dto)
    {
         professionalQualificationService.insertProfessionalQualification(expertId,dto);
         return AjaxResult.success();
    }

    /**
     * 修改职业资格
     */
    @ApiOperation("修改职业资格")
    @Log(title = "职业资格", businessType = BusinessType.UPDATE)
    @PutMapping("/editSave")
    public AjaxResult edit(@RequestBody UpdateProfessionalQualificationDto dtoS)
    {
        return toAjax(professionalQualificationService.updateProfessionalQualification(dtoS));
    }

    /**
     * 删除职业资格
     */
    @ApiOperation("删除职业资格")
    @Log(title = "职业资格", businessType = BusinessType.DELETE)
	@DeleteMapping("/{professionalId}")
    public AjaxResult remove(@PathVariable Long professionalId)
    {
        return toAjax(professionalQualificationService.deleteProfessionalQualificationByProfessionalId(professionalId));
    }
}
